import { Inject, Injectable } from '@nestjs/common';
import { InferSelectModel } from 'drizzle-orm';
import { MySql2Database } from 'drizzle-orm/mysql2';

import { DRIZZLE_CONNECTION } from '@database/constants/database.constants';
import { requestMap } from '@database/schema';

@Injectable()
export class RequestMapsRepository {
  constructor(
    @Inject(DRIZZLE_CONNECTION)
    private readonly db: MySql2Database,
  ) {}

  async query(): Promise<InferSelectModel<typeof requestMap>[]> {
    const query = await this.db.select().from(requestMap);
    return query;
  }
}
